package com.fulihui.common.result.web;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.List;

/**
 * @author: Levon
 * @version: v 0.1 2018-06-08 11:09
 */
@Getter
@Setter
@ToString
@ApiModel(value = "分页包装对象", description = "分页包装对象")
public class PageView<T> {

    @ApiModelProperty(value = "当前页")
    private int page = 1;

    @ApiModelProperty(value = "每页条数")
    private int rows = 10;

    @ApiModelProperty(value = "总页数")
    private int totalSize;

    @ApiModelProperty(value = "总条数")
    private int totalRows;

    @ApiModelProperty(value = "数据集")
    private List<T> values;

    public int start() {
        return page > 1 ? (page - 1) * totalSize : 0;
    }

}
